//package com.kungfuhacking.wristbandpro.find.presenter;
//
//import android.content.Context;
//import android.support.v7.widget.RecyclerView;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.ImageView;
//import android.widget.TextView;
//
//import com.kungfuhacking.wristbandpro.R;
//import com.kungfuhacking.wristbandpro.find.bean.OrderInfo;
//import com.kungfuhacking.wristbandpro.utils.Constant;
//
//import java.util.List;
//
///**
// * Created by Aaron on 17/5/11.
// */
//
//public class OrderHistoryAdapter extends RecyclerView.Adapter<OrderHistoryAdapter.MyViewHolder> {
//
//    private Context context;
//    private List<OrderInfo> orderInfoList;
//
//    public OrderHistoryAdapter(Context ctx, List<OrderInfo> orderInfoList) {
//        this.context = ctx;
//        this.orderInfoList = orderInfoList;
//    }
//
//    public void setOrderInfoList(List<OrderInfo> orderInfoList) {
//        this.orderInfoList = orderInfoList;
//    }
//
//    @Override
//    public OrderHistoryAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//        return new OrderHistoryAdapter.MyViewHolder(
//                LayoutInflater.from(context).inflate(R.layout.item_order_history, parent,
//                        false));
//    }
//
//    @Override
//    public void onBindViewHolder(OrderHistoryAdapter.MyViewHolder holder, int position) {
//
//        String pay_style = "";
//        switch (orderInfoList.get(position).getPayType()) {
//            case Constant.PAY_STYLE_ALIPAY:
//                pay_style = "支付宝";
//                break;
//            case Constant.PAY_STYLE_WEIXIN:
//                pay_style = "微信";
//                break;
//            default:
//                pay_style = "其他";
//                break;
//        }
//
//        //价格
//        holder.tv_price.setText("价格: " + orderInfoList.get(position).getFee() + "元");
//        //订单号
//        holder.tv_num.setText("订单号: " + orderInfoList.get(position).getTradeNo());
//        //商品名称
//        holder.tv_goods.setText(orderInfoList.get(position).getSubject());
//        //下单时间
//        holder.tv_time.setText("支付时间: " + orderInfoList.get(position).getAddTime());
//        //支付方式
//        holder.tv_style.setText("支付方式: " + pay_style);
//        //支付状态图标
//        if (orderInfoList.get(position).getTradeState().equals("SUCCESS")) {
//            //支付成功
//            holder.iv_status.setImageResource(R.mipmap.ic_order_success);
//            holder.tv_detail.setVisibility(View.VISIBLE);
//        } else {
//            //支付失败
//            holder.iv_status.setImageResource(R.mipmap.ic_order_fail);
//            holder.tv_detail.setVisibility(View.INVISIBLE);
//        }
//    }
//
//    @Override
//    public int getItemCount() {
//        return orderInfoList.size();
//    }
//
//    class MyViewHolder extends RecyclerView.ViewHolder {
//
//        TextView tv_price;
//        TextView tv_num;
//        TextView tv_goods;
//        TextView tv_time;
//        TextView tv_style;
//        TextView tv_detail;
//        ImageView iv_status;
//        View view;
//
//        MyViewHolder(View view) {
//            super(view);
//
//            this.view = view;
//            tv_price = (TextView) view.findViewById(R.id.tv_price);
//            tv_num = (TextView) view.findViewById(R.id.tv_num);
//            tv_goods = (TextView) view.findViewById(R.id.tv_goods);
//            tv_time = (TextView) view.findViewById(R.id.tv_time);
//            tv_style = (TextView) view.findViewById(R.id.tv_style);
//            tv_detail = (TextView) view.findViewById(R.id.tv_detail);
//            iv_status = (ImageView) view.findViewById(R.id.iv_status);
//        }
//    }
//}
